﻿﻿@extends('admin.Default')
@section('type')
    <link href="{{ asset('myadmin/css/plugins/dataTables/dataTables.bootstrap.css') }}" rel="stylesheet">
@stop
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="panel blank-panel">
                    <div class="panel-heading">
                        <div class="panel-title m-b-md">
                            <h4>您当前位置：订单管理->订单列表</h4>
                        </div>
                        <div class="panel-options">

                            <ul class="nav nav-tabs">
                                <li><a data-toggle="tab" href="#tab-1">待发货</a>
                                </li>
                                <li><a data-toggle="tab" href="#tab-2">待付款</a>
                                </li>
                                <li ><a data-toggle="tab" href="#tab-3">待收货</a>
                                </li>
                                <li ><a data-toggle="tab" href="#tab-4">待评价</a>
                                </li>
                                <li ><a data-toggle="tab" href="#tab-5">已完成</a>
                                </li>
                                <li ><a  data-toggle="tab" href="#tab-6">全部订单</a>
                                </li>
                            </ul>
                        </div>
                    </div>

                    <div class="panel-body">

                        <div class="tab-content">

                            <div id="tab-1" class="tab-pane active"  >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>代发货</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status == 2)
                                                                <tr>
                                                                    <input type="hidden" name="order_id{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="tab-2" class="tab-pane active" >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>代付款</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status == 1)
                                                                <tr>
                                                                    <input type="hidden" name="order_id{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="tab-3" class="tab-pane active" >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>代收货</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status == 3)
                                                                <tr>
                                                                    <input type="hidden" name="order_id{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="tab-4" class="tab-pane active" >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>代评价</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status == 4)
                                                                <tr>
                                                                    <input type="hidden" name="order_id{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="tab-5" class="tab-pane active" >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>已完成</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status == 5)
                                                                <tr>
                                                                    <input type="hidden" name="order_id{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div id="tab-6" class="tab-pane active" >
                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="ibox float-e-margins">
                                            <div class="ibox-title">
                                                <h5>订单： <small>全部订单</small></h5>
                                            </div>
                                            <div class="ibox-content">
                                                <input type='hidden' name='_token' value='{{ csrf_token() }}'>
                                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                                    <thead>
                                                    <tr >
                                                        <th >订单编号</th>
                                                        <th >商家编号</th>
                                                        <th >下单时间</th>
                                                        <th >订单状态</th>
                                                        <th >收货人</th>
                                                        <th >收货人电话</th>
                                                        <th >收货人地址</th>
                                                        <th >支付方式</th>
                                                        <th >实付款</th>
                                                        <th >审核医师</th>
                                                        <th >配送员</th>
                                                        <th >订单备注</th>
                                                        <th >&nbsp;&nbsp;&nbsp;操&nbsp;&nbsp;&nbsp;作&nbsp;&nbsp;</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    @if($list != null)
                                                        @foreach($list as $v)
                                                            @if($v->status != 7)
                                                                <tr>
                                                                    <input type="hidden" name="order{{ $v->id }}" >
                                                                    <td>{{ $v->number }}</td>
                                                                    <td>{{ $v->store_id }}</td>
                                                                    <td>{{ $v->created_at }}</td>
                                                                    <td>{{ $status[$v->status] }}</td>
                                                                    <td>{{ $v->name }}</td>
                                                                    <td>{{ $v->phone }}</td>
                                                                    <td>{{ $v->address }}</td>
                                                                    <td>{{ $v->paymethod == 1 ? '支付宝付款':($v->paymethod == 2?'微信付款':'货到付款') }}</td>
                                                                    <td>{{ $v->realpay }}</td>
                                                                    <td>{{ $v->doctor_id }}</td>
                                                                    <td>{{ $v->sender_id }}</td>
                                                                    <td>{{ $v->remark }}</td>
                                                                    <td>
                                                                        <a onclick="updateorder(this,{{ $v }});" data-toggle="modal" class="" href="#modal-form-two">修改</a> |
                                                                        <a onclick="doaddress({{ $v->id }},'{{ $v->number }}',{{ $v->amount }},{{ $v->discount }},{{ $v->carriage }},{{ $v->realpay }});" data-toggle="modal" class="" href="#modal-form-one"  >订单详情</a> |
                                                                        <a onclick="deleteorder(this,{{ $v->id }});">放入回收站</a>
                                                                    </td>
                                                                </tr>
                                                            @endif
                                                        @endforeach
                                                    @endif
                                                    </tbody>
                                                </table>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
            </div>


        </div>
    </div>

    <div id="modal-form-one" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <h5 id="order"></h5>
                                    <h5 id="order_info"></h5>
                                    <div class="ibox-tools">
                                        <a class="collapse-link">
                                            <i class="fa fa-chevron-up"></i>
                                        </a>

                                    </div>
                                </div>
                                <div class="ibox-content ">

                                    <table class="table table-bordered order">
                                        <thead>
                                        <tr>
                                            <th >药品编号</th>
                                            <th >药品名称</th>
                                            <th >药品单价</th>
                                            <th >药品数量</th>
                                            <th >药品规格</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="modal-form-two" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-6">
                            <div class="ibox float-e-margins">
                                <div class="ibox-title">
                                    <h5 id="order">订单信息获取失败，请重试</h5>
                                </div>
                                <div class="ibox-content ">
                                    <form action="" method="post" id="myform" >
                                        <input type="hidden" name="id" class="form-control" value="">
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">收货人：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="name" class="form-control" value="" placeholder="收货人" >
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">手机号：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="phone" class="form-control" value="" placeholder="手机号">
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">收货地址：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="address"  class="form-control" value=""  placeholder="收货地址"  >
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">实付款：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="realpay"  class="form-control"  value="" placeholder="实付款"  >
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">审核医师：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="doctor_id"  class="form-control" value=""  placeholder="审核医师"  >
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">配送员：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="sender_id"  class="form-control" value=""  placeholder="配送员"  >
                                            </div>
                                        </div>
                                        <div class="form-group row">
                                            <label class="col-sm-2 control-label">订单备注：</label>
                                            <div class="col-sm-6">
                                                <input type="text" name="remark"  class="form-control" value=""  placeholder="订单备注"  >
                                            </div>
                                        </div>
                                        <button class="btn btn-primary"  onclick="editorder();" type="button"  style="margin-left: 200px;"><strong>提交</strong></button>
                                        <button class="btn btn-primary" type="reset"><strong>重置</strong></button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Mainly scripts -->

    @if($list == null)
        <script>alert('你还没有订单！')</script>
    @endif
@stop
@section('script')
    <script type="text/javascript" src="{{ asset('myadmin/js/jquery.min.js') }}"></script><script type="text/javascript"  src="{{ asset('myadmin/js/jquery-2.1.1.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/bootstrap.min.js?v=3.4.0') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/metisMenu/jquery.metisMenu.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/slimscroll/jquery.slimscroll.min.js') }}"></script>
    <!-- iCheck -->
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/iCheck/icheck.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dropzone/dropzone.js') }}"></script>

    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/jeditable/jquery.jeditable.js') }}"></script>

    <!-- Data Tables -->
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dataTables/jquery.dataTables.js') }}"></script>
    <script type="text/javascript" src="{{ asset('myadmin/js/plugins/dataTables/dataTables.bootstrap.js') }}"></script>
    <script type="text/javascript">

        //订单详情
        function doaddress(id, number, amount, discount, carriage ,realpay)
        {
            $('.order tbody').children().remove();
            $.ajax({
                url:'{{ url("admin/user/ajax/selorder") }}',
                async:false,				//是否异步
                type:'post',				//请求方式
                data:{id:id, status:status,  '_token': $('input[name=_token]').val()},				//发送的数据
                dataType:'json',			//响应的数据类型
                success:function(data)		//成功时回调函数
                {
                    if(data == null){
                        $('.order').css('display','none');
                        $('#order_info').css('display','none');
                        $('#order').html('订单：'+ number +' 信息查询失败请稍候重试');
                    }else{
                        $('.order').css('display','');
                        $('#order_info').css('display','');
                        $('#order').html('订单：'+ number +' 详细信息如下：');
                        $('#order_info').html('药品总价：'+ amount +' - 优惠金额：'+ discount +' + 运费:'+ carriage +' = 付款金额：'+ realpay);
                        for (var i = 0; i < data.length; i++) {
                            $('.order tbody').append("<tr><td>"+data[i].product_id+"</td><td>"+data[i].name+"</td><td>"+data[i].price+"</td><td>"+data[i].count+"</td><td>"+data[i].specifications+"</td></tr>");
                        };
                    }
                }
            });
        }

        //订单回收站
        function deleteorder(bn, id)
        {
            if(confirm("你确定要这样做吗？")) {
                $.ajax({
                    url: '{{ url("admin/user/ajax/deleteorder") }}',
                    async: false,				//是否异步
                    type: 'post',				//请求方式
                    data: {id: id, status: status, '_token': $('input[name=_token]').val()},				//发送的数据
                    dataType: 'json',			//响应的数据类型
                    success: function (data)		//成功时回调函数
                    {
                        if (data == '成功') {
                            alert('放入回收站' + data);
                            $(bn).parent().parent().css('display', 'none');
                        } else {
                            alert('放入回收站' + data);
                        }
                    }
                });
            }
        }

        //弹出修改订单，并添加默认值
        function updateorder(bn , list)
        {

            $('input[name=id]').val(list.id);
            $('input[name=name]').val(list.name);
            $('input[name=phone]').val(list.phone);
            $('input[name=address]').val(list.address);
            $('input[name=realpay]').val(list.realpay);
            $('input[name=doctor_id]').val(list.doctor_id);
            $('input[name=sender_id]').val(list.sender_id);
            $('input[name=remark]').val(list.remark);
        }

        //执行修改
        function editorder()
        {

            var id = $('input[name=id]').val();
            var name = $('input[name=name]').val();
            var phone = $('input[name=phone]').val();
            var address = $('input[name=address]').val();
            var realpay = $('input[name=realpay]').val();
            var doctor_id = $('input[name=doctor_id]').val();
            var sender_id = $('input[name=sender_id]').val();
            var remark = $('input[name=remark]').val();

            $.ajax({
                url:'{{ url("admin/user/ajax/editorder") }}',
                async:false,				//是否异步
                type:'post',				//请求方式
                data:{id:id, name:name, phone:phone, address:address, realpay:realpay, doctor_id:doctor_id, sender_id:sender_id, remark:remark, '_token': $('input[name=_token]').val()},				//发送的数据
                dataType:'json',			//响应的数据类型
                success:function(data)		//成功时回调函数
                {
                    if(data == '成功'){
                        alert('修改'+data);
                        var bn = $('input[name=order_id'+id+']').parent().children();
                        bn.eq(4).html(name);
                        bn.eq(5).html(phone);
                        bn.eq(6).html(address);
                        bn.eq(8).html(realpay);
                        bn.eq(9).html(doctor_id);
                        bn.eq(10).html(sender_id);
                        bn.eq(11).html(remark);
                        var bn = $('input[name=order'+id+']').parent().children();
                        bn.eq(4).html(name);
                        bn.eq(5).html(phone);
                        bn.eq(6).html(address);
                        bn.eq(8).html(realpay);
                        bn.eq(9).html(doctor_id);
                        bn.eq(10).html(sender_id);
                        bn.eq(11).html(remark);
                    }else{
                        alert('修改'+data+'请重试');
                    }
                }
            });
        }

        $(document).ready(function () {
            $('.dataTables-example').dataTable();
            var oTable = $('#editable').dataTable();
            oTable.$('td').editable('../example_ajax.php', {
                "callback": function (sValue, y) {
                    var aPos = oTable.fnGetPosition(this);
                    oTable.fnUpdate(sValue, aPos[0], aPos[1]);
                },
                "submitdata": function (value, settings) {
                    return {
                        "row_id": this.parentNode.getAttribute('id'),
                        "column": oTable.fnGetPosition(this)[2]
                    };
                },
                "width": "90%",
                "height": "100%"
            });
        });
    </script>

@stop